<template>
    <div>
        <button @click="add">点击</button>
        <hr>
        <button @click="add2">点击2</button>
        <hr>
        <table border="1" cellspacing="0">
            <thead>
                <tr>
                    <th>姓名</th>
                    <th>年龄</th>
                    <th>性别</th>
                </tr>
            </thead>
            <tbody>
                <tr v-for="item, index in arr" :key="index">
                    <td>{{ item.name }}</td>
                    <td>{{ item.age }}</td>
                    <td>{{ item.gender }}</td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script>
import { axiosApi } from "./axios/api"
export default {
    data() {
        return {
            arr: []
        }
    },
    mounted() {
        axiosApi.get1().then((val) => {
            this.arr = val
            console.log('add', val);
        })
    },
    methods: {
        add() {
            axiosApi.get1().then((val) => {
                console.log('add', val);
            })
        },
        add2() {
            axiosApi.post1(this.form).then((val) => {
                console.log('add2', val);
            })
        }
    }
}
</script>

<style lang="less" scoped></style>